package com.wufan.day05.exer;

/**
 * @author SongWufan
 * @date 2021/3/9 20:30
 */
public class Person {
    private int age;
    private String name;

    public Person() {
        this.age = 18;
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void setAge(int age) {
        if (age < 0 || age > 130) {
            System.out.println("数据非法");
        }
        else {
            this.age = age;
        }
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}
